import request from "./request"
import QS from 'qs'

const uploadImgUrl = 'https://nei.netease.com/api/apimock-v2/25a1f23834741ff80cceeaec76dedf48/api/shopAdmin/uploadImg'

const apiUrl = {

    /*  登录 */
    "musicDetail":{
        url:"searchMusic",
        type:"GET"
    },
    layout:{
        url:"shopAdmin/layout",
        tyle:"GET",
        "contentType":"multipart/form-data"
    }
 
  }

function axios(api,data){
    let url = apiUrl[api]
    if(!url){
        console.error("没有对应得api url 配置")
        return new Promise((relover,reject)=>{
            reject({msg:"没有对应得api url 配置"})
        })
    }
    let contentType = url["contentType"]
    if(!contentType){
    contentType = "application/json"
    }
    
    return request({
    url: url.url,
    method:url.type,
    headers:{
        "Content-Type":contentType
    },
    params:data
    })
}
export {
    axios,uploadImgUrl
}